import PySpice

temperatures=range(50)
temps=[]

for temps in temperatures:
    tempval=(float(temps)/5.0)+25.0

    #print "Setting temperature to " + str(tempval)
    
    tempcom="set_temp " + str(tempval)
    PySpice.Command(tempcom)

    PySpice.Command(tempcom)
    
    PySpice.Command("scanrel s1 1.5 -1.5 0.15")
    PySpice.Command("com s1")
    
    s1val=PySpice.motorpositions('s1')
    PySpice.Command("th2th 2 -2 0.2")
    PySpice.Command("com s2")
    
    drivecommand="drive s1 " + str(s1val)
    PySpice.Command(drivecommand)

